# NO constraints is a check on what model would produce if no structural values
# 11/9 models for submission (fingers crossed); add immgen and gender to race fn; no selection endow
# run a sequence of models

library(RSiena)
library(parallel)

rm(list=ls())

#Set working directory
setwd('/Users/drschaef/Google Drive/Projects/Adriana/Papers/Homophily/Output')
setwd('/Users/drschaef/My Drive/Projects/Adriana/Papers/Homophily/Output')

mydatRF <-  readRDS("rfnetM123_remove10s11s.rds") # friendships and race only
myeff <- readRDS('tempM/myeffM_231109.RDS')
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='creation', include=T, fix=F, test=F)
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='endow', include=T, fix=F, test=F)
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='eval', include=F, fix=F, test=F)
myAlgorithm <- sienaAlgorithmCreate( projname = 'model231109_noConstraints', nsub=4, n3=2000)
stVal <- readRDS('tempM/fullModelM_230715.RDS')
mM <- siena07( myAlgorithm, data = mydatRF, effects = myeff, useCluster=T, initC=T, nbrNodes=7, prevAns=stVal)

mydatRF <-  readRDS("rfnetS123_remove10s11s.rds") # friendships and race only
myeff <- readRDS('tempS/myeffS_231109.RDS')
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='creation', include=T, fix=F, test=F)
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='endow', include=T, fix=F, test=F)
myeff <- setEffect(myeff, to, name="raceNet", interaction1="friendship", type='eval', include=F, fix=F, test=F)
stVal <- readRDS('tempS/fullModelS_230715.RDS')
mS <- siena07( myAlgorithm, data = mydatRF, effects = myeff, useCluster=T, initC=T, nbrNodes=7, prevAns=stVal)
